package com.dropdb.demo.controller.wx;

import com.dropdb.demo.bean.vo.BaseRespVO;
import com.dropdb.demo.service.WxStorageUploadService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * @author:tanxin Desc: 图片上传
 * @date:2020/7/1 12:28
 */
@RestController
@RequestMapping("/wx/storage/")

public class WxStorageUploadController {
    @Value("${mall.upload-path}")
    String uploadPath;

    @Resource
    WxStorageUploadService wxStorageUploadService;
    @RequestMapping("upload")
    public BaseRespVO filesUpload(@RequestParam("file") MultipartFile file, HttpServletRequest request){
       BaseRespVO baseRespVO = wxStorageUploadService.fileUpload(file,request,uploadPath);
       return baseRespVO;
    }
}
